package com.example.hello_word.descImg;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class DescImgServiceImpl implements DescImgService{

    @Autowired
    DescImgRep descImgRep;

    @Override
    public List<DescImg> findAll() {
        List<DescImg> list = descImgRep.findAll();
        return list;
    }

    @Override
    public DescImg findById(Integer id) {
        Optional<DescImg> descImgRepById = descImgRep.findById(id);
        return descImgRepById.get();
    }

    @Override
    public void save(DescImg descImg) {
        descImgRep.save(descImg);
    }

    @Override
    public void update(DescImg descImg) {
        descImgRep.save(descImg);
    }

    @Override
    public void deleteById(Integer id) {
        descImgRep.deleteById(id);
    }
}
